﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;
using System.Web.Caching;

using CqusInfo.RAL.User;
using CqusInfo.RAL.Permissions;
using CqusInfo.RAL.Community;
using CqusInfo.RAL.Infomation;
using CqusInfo.RAL.Interaction;
using CqusInfo.RAL.Question;
using CqusInfo.RAL.Barter;

namespace CqusInfo.CR.SqlHelper
{
    public class SqlData
    {
        /// <summary>
        /// 得到查询的数据并转换为需要的List
        /// </summary>
        /// <param name="cacheId">缓存中的ID</param>
        /// <param name="modelName">model数据集名称（如：UserModel）</param>
        /// <param name="ds">数据集</param>
        /// <returns>IList</returns>
        public static List<T> GetQueryList<T>(string cacheId, string modelName, DataSet ds)
        {
            List<T> functionList = new List<T>();
            var o = CqusInfo.CR.Tool.CacheManage.DefaultStrategy.GetEntity().RetrieveObject(cacheId);
            if (o == null)
            {
                for (Int32 i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    functionList.Add(GetModel(modelName,ds,i));
                }
                CqusInfo.CR.Tool.CacheManage.DefaultStrategy.GetEntity().AddObjectWithAbsoluteTime(
                    cacheId,
                    functionList,
                    600000,
                    System.Web.Caching.CacheItemPriority.Normal);
                return functionList;
            }
            return (List<T>)o;
        }

        /// <summary>
        /// 得到数据集Model
        /// </summary>
        /// <param name="modelName">model数据集名称（如：UserModel）</param>
        /// <param name="ds">数据集</param>
        /// <param name="number">第几行，应用于多行数据</param>
        /// <returns>动态的数据信息</returns>
        private static dynamic GetModel(string modelName,DataSet ds,Int32 number)
        {
            switch (modelName)
            {
                #region User 用户管理
                case "UserModel": 
                    return U_DataSetToModel(ds, number);
                case "User_InfoToBasicModel": 
                    return UITB_DataSetToModel(ds, number);
                case "User_InfoToLoveModel": 
                    return UITL_DataSetToModel(ds, number);
                case "User_InfoToSchoolModel":
                    return UITS_DataSetToModel(ds, number);
                case "User_BlackModel":
                    return UB_DataSetToModel(ds, number);
                #endregion

                #region Permissions 权限管理
                case "FunctionModel":
                    return F_DataSetToModel(ds, number);
                case "RoleModel":
                    return R_DataSetToModel(ds, number);
                case "User_FunctionModel":
                    return UF_DataSetToModel(ds, number);
                case "User_RoleModel":
                    return UR_DataSetToModel(ds, number);
                case "Role_FunctionModel":
                    return RF_DataSetToModel(ds, number);
                #endregion

                #region Community 社区管理
                case "FeelingsModel":
                    return FE_DataSetToModel(ds, number);
                case "DiaryModel":
                    return D_DataSetToModel(ds, number);
                case "Diary_TypeModel":
                    return DT_DataSetToModel(ds, number);
                case "AlbumModel":
                    return A_DataSetToModel(ds, number);
                case "Album_PhotoModel":
                    return AP_DataSetToModel(ds, number);
                case "AboutMeModel":
                    return AM_DataSetToModel(ds, number);
                case "FriendsModel":
                    return F_DataSetToModel(ds, number);
                case "Friends_GroupModel":
                    return FG_DataSetToModel(ds, number);
                case "User_Friends_GroupModel":
                    return UFG_DataSetToModel(ds, number);
                case "MessagesModel":
                    return M_DataSetToModel(ds, number);
                case "CommentsModel":
                    return C_DataSetToModel(ds, number);
                #endregion

                #region Interaction 互动专区
                case "OtherModel":
                    return O_DataSetToModel(ds, number);
                case "Other_CommentModel":
                    return OC_DataSetToModel(ds, number);
                case "GameModel":
                    return G_DataSetToModel(ds, number);
                #endregion

                #region Querstion 客户意见
                case "QuestionModel":
                    return Q_DataSetToModel(ds, number);
                case "Question_CommentModel":
                    return QC_DataSetToModel(ds, number);
                #endregion

                #region Infomation 资讯管理
                case "InfomationModel":
                    return I_DataSetToModel(ds, number);
                case "Infomation_TypeModel":
                    return IT_DataSetToModel(ds, number);
                case "Infomation_CommentModel":
                    return IC_DataSetToModel(ds, number);
                #endregion

                #region Barter 以物易物
                case "User_ShopsModel":
                    return USP_DataSetToModel(ds, number);
                case "User_ComplaintsModel":
                    return UC_DataSetToModel(ds, number);
                case "ShopsModel":
                    return SP_DataSetToModel(ds, number);
                case "Shops_DetailsModel":
                    return SPD_DataSetToModel(ds, number);
                case "Shops_TypeModel":
                    return SPT_DataSetToModel(ds, number);
                case "Shops_NeedsModel":
                    return SN_DataSetToModel(ds, number);
                case "Shops_EvaluationModel":
                    return SE_DataSetToModel(ds, number);
                case "Shops_Evaluation_ReplayModel":
                    return SER_DataSetToModel(ds, number);
                case "Shops_TransactionRecordModel":
                    return STR_DataSetToModel(ds, number);
                #endregion

                #region Source 资源管理
                #endregion
            }
            return null;
        }

        #region 得到数据集Model

        #region User 用户管理
        /// <summary>
        /// UserModel
        /// </summary>
        private static UserModel U_DataSetToModel(DataSet ds, Int32 number)
        {
            UserModel userModel = new UserModel();

            DataRow row = ds.Tables[0].Rows[number];

            userModel.c_vc_userName = row["c_vc_userName"].ToString();
            userModel.c_vc_passWord = row["c_vc_passWord"].ToString();
            userModel.c_vc_email = row["c_vc_email"].ToString();
            userModel.c_b_isAlive = Convert.ToBoolean(row["c_b_isAlive"]);
            userModel.c_b_isLock = Convert.ToBoolean(row["c_b_isLock"]);
            userModel.c_nvc_nickName = row["c_nvc_nickName"].ToString();
            userModel.c_b_isComplete = Convert.ToBoolean(row["c_b_isComplete"]);
            userModel.c_dt_regDate = Convert.ToDateTime(row["c_dt_regDate"]);
            userModel.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return userModel;
        }
        /// <summary>
        /// User_InfoToBasicModel
        /// </summary>
        private static User_InfoToBasicModel UITB_DataSetToModel(DataSet ds, Int32 number)
        {
            User_InfoToBasicModel userModel = new User_InfoToBasicModel();

            DataRow row = ds.Tables[0].Rows[number];

            userModel.c_vc_uitId = row["c_vc_uitId"].ToString();
            userModel.c_vc_realName = row["c_vc_userName"].ToString();
            userModel.c_vc_qq = row["c_vc_qq"].ToString();
            userModel.c_vc_mobile = row["c_vc_mobile"].ToString();
            userModel.c_vc_home = row["c_vc_home"].ToString();
            userModel.c_vc_photo = row["c_vc_photo"].ToString();
            userModel.c_vc_province = row["c_vc_province"].ToString();
            userModel.c_vc_constellation = row["c_vc_constellation"].ToString();
            userModel.c_i_age = Convert.ToInt32(row["c_i_age"]);
            userModel.c_vc_address = row["c_vc_address"].ToString();
            userModel.c_vc_bloodType = row["c_vc_bloodType"].ToString();
            userModel.c_vc_city = row["c_vc_city"].ToString();
            userModel.c_vc_sex = row["c_vc_sex"].ToString();

            return userModel;
        }
        /// <summary>
        /// User_InfoToLoveModel
        /// </summary>
        private static User_InfoToLoveModel UITL_DataSetToModel(DataSet ds, Int32 number)
        {
            User_InfoToLoveModel userModel = new User_InfoToLoveModel();

            DataRow row = ds.Tables[0].Rows[number];

            userModel.c_vc_uitlId = row["c_vc_uitlId"].ToString();
            userModel.c_tx_other = row["c_tx_other"].ToString();
            userModel.c_vc_book = row["c_vc_book"].ToString();
            userModel.c_vc_digital = row["c_vc_digital"].ToString();
            userModel.c_vc_food = row["c_vc_food"].ToString();
            userModel.c_vc_game = row["c_vc_game"].ToString();
            userModel.c_vc_love = row["c_vc_love"].ToString();
            userModel.c_vc_movie = row["c_vc_movie"].ToString();
            userModel.c_vc_music = row["c_vc_music"].ToString();
            userModel.c_vc_sports = row["c_vc_sports"].ToString();
            userModel.c_vc_star = row["c_vc_star"].ToString();
            userModel.c_vc_travel = row["c_vc_travel"].ToString();

            return userModel;
        }
        /// <summary>
        /// User_InfoToSchoolModel
        /// </summary>
        private static User_InfoToSchoolModel UITS_DataSetToModel(DataSet ds, Int32 number)
        {
            User_InfoToSchoolModel userModel = new User_InfoToSchoolModel();

            DataRow row = ds.Tables[0].Rows[number];

            userModel.c_vc_uitsId = row["c_vc_uitsId"].ToString();
            userModel.c_vc_school = row["c_vc_school"].ToString();
            userModel.c_vc_schoolAddress = row["c_vc_schoolAddress"].ToString();
            userModel.c_vc_departments = row["c_vc_departments"].ToString();
            userModel.c_vc_professional = row["c_vc_professional"].ToString();
            userModel.c_vc_class = row["c_vc_class"].ToString();

            return userModel;
        }
        /// <summary>
        /// User_BlackModel
        /// </summary>
        private static User_BlackModel UB_DataSetToModel(DataSet ds, Int32 number)
        {
            User_BlackModel userModel = new User_BlackModel();

            DataRow row = ds.Tables[0].Rows[number];

            userModel.c_vc_ubId = row["c_vc_ubId"].ToString();
            userModel.c_vc_admin = row["c_vc_admin"].ToString();
            userModel.c_vc_userName = row["c_vc_userName"].ToString();
            userModel.c_i_type = Convert.ToInt32(row["c_i_type"]);
            userModel.c_i_warningNO = Convert.ToInt32(row["c_i_warningNO"]);
            userModel.c_b_black = Convert.ToBoolean(row["c_b_black"]);
            userModel.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            userModel.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return userModel;
        }
        #endregion

        #region Permissions 权限管理

        /// <summary>
        /// FunctionModel
        /// </summary>
        private static FunctionModel F_DataSetToModel(DataSet ds, Int32 number)
        {
            FunctionModel model = new FunctionModel();

            DataRow row = ds.Tables[0].Rows[number];
            model.c_vc_fId = row["c_vc_fId"].ToString();
            model.c_vc_functionName = row["c_vc_functionName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// RoleModel
        /// </summary>
        private static RoleModel R_DataSetToModel(DataSet ds, Int32 number)
        {
            RoleModel model = new RoleModel();
            DataRow row = ds.Tables[0].Rows[number];
            model.c_vc_fId = row["c_vc_fId"].ToString();
            model.c_vc_roleName = row["c_vc_roleName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// User_FunctionModel
        /// </summary>
        private static User_FunctionModel UF_DataSetToModel(DataSet ds, Int32 number)
        {
            User_FunctionModel model = new User_FunctionModel();
            DataRow row = ds.Tables[0].Rows[number];
            model.c_vc_urId = row["c_vc_urId"].ToString();
            model.c_vc_fId = row["c_vc_fId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();

            return model;
        }
        /// <summary>
        /// User_RoleModel
        /// </summary>
        private static User_RoleModel UR_DataSetToModel(DataSet ds, Int32 number)
        {
            User_RoleModel model = new User_RoleModel();
            DataRow row = ds.Tables[0].Rows[number];
            model.c_vc_urId = row["c_vc_urId"].ToString();
            model.c_vc_rId = row["c_vc_rId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();

            return model;
        }
        /// <summary>
        /// Role_FunctionModel
        /// </summary>
        private static Role_FunctionModel RF_DataSetToModel(DataSet ds, Int32 number)
        {
            Role_FunctionModel model = new Role_FunctionModel();
            DataRow row = ds.Tables[0].Rows[number];
            model.c_vc_fId = row["c_vc_fId"].ToString();
            model.c_vc_rId = row["c_vc_rId"].ToString();
            model.c_vc_urId = row["c_vc_urId"].ToString();

            return model;
        }
        #endregion

        #region Community 社区管理
        /// <summary>
        /// FeelingsModel
        /// </summary>
        private static FeelingsModel FE_DataSetToModel(DataSet ds, Int32 number)
        {
            FeelingsModel model = new FeelingsModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_feId = row["c_vc_feId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_i_commentNO = Convert.ToInt32(row["c_i_commentNO"]);
            model.c_b_isOpen = Convert.ToBoolean(row["c_b_isOpen"]);
            model.c_i_openNO = Convert.ToInt32(row["c_i_openNO"]);
            model.c_dt_dateTime = Convert.ToDateTime(row[""]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// DiaryModel
        /// </summary>
        private static DiaryModel D_DataSetToModel(DataSet ds, Int32 number)
        {
            DiaryModel model = new DiaryModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_dId = row["c_vc_dId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_dtId = row["c_vc_dtId"].ToString();
            model.c_ntx_content = row["c_ntx_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_i_commentNO = Convert.ToInt32(row["c_i_commentNO"]);
            model.c_i_readNO = Convert.ToInt32(row["c_i_readNO"]);
            model.c_i_open = Convert.ToInt32(row["c_i_Open"]);
            model.c_i_reprintNO = Convert.ToInt32(row["c_i_reprintNO"]);
            model.c_shareNO = Convert.ToInt32(row["c_shareNO"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Diary_TypeModel
        /// </summary>
        private static Diary_TypeModel DT_DataSetToModel(DataSet ds, Int32 number)
        {
            Diary_TypeModel model = new Diary_TypeModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_dtId = row["c_vc_dtId"].ToString();
            model.c_vc_typeName = row["c_vc_typeName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// AlbumModel
        /// </summary>
        private static AlbumModel A_DataSetToModel(DataSet ds, Int32 number)
        {
            AlbumModel model = new AlbumModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_aId = row["c_vc_aId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_vc_albumName = row["c_vc_albumName"].ToString();
            model.c_i_photoNO = Convert.ToInt32(row["c_i_photoNO"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Album_PhotoModel
        /// </summary>
        private static Album_PhotoModel AP_DataSetToModel(DataSet ds, Int32 number)
        {
            Album_PhotoModel model = new Album_PhotoModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_aId = row["c_vc_aId"].ToString();
            model.c_vc_apId = row["c_vc_apId"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_vc_photoName = row["c_vc_photoName"].ToString();
            model.c_tx_URL = row["c_tx_URL"].ToString();
            model.c_i_commentNO = Convert.ToInt32(row["c_i_c_i_commentNOphotoNO"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// AboutMeModel
        /// </summary>
        private static AboutMeModel AM_DataSetToModel(DataSet ds, Int32 number)
        {
            AboutMeModel model = new AboutMeModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_amId = row["c_vc_mcId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_people = row["c_vc_people"].ToString();
            model.c_vc_things = row["c_vc_things"].ToString();
            model.c_vc_other = row["c_vc_other"].ToString();
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// FriendsModel
        /// </summary>
        private static FriendsModel FR_DataSetToModel(DataSet ds, Int32 number)
        {
            FriendsModel model = new FriendsModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_frId = row["c_vc_frId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_friendName = row["c_vc_friendName"].ToString();
            model.c_b_isSpecial = Convert.ToBoolean(row["c_b_isSpecial"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Friends_GroupModel
        /// </summary>
        private static Friends_GroupModel FG_DataSetToModel(DataSet ds, Int32 number)
        {
            Friends_GroupModel model = new Friends_GroupModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_fgId = row["c_vc_fgId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_groupName = row["c_vc_groupName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// User_Friends_GroupModel
        /// </summary>
        private static User_Friends_GroupModel UFG_DataSetToModel(DataSet ds, Int32 number)
        {
            User_Friends_GroupModel model = new User_Friends_GroupModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_fgId = row["c_vc_fgId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_ufgId = row["c_vc_ufgId"].ToString();
            model.c_vc_friendName = row["c_vc_friendName"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// MessagesModel
        /// </summary>
        private static MessagesModel M_DataSetToModel(DataSet ds, Int32 number)
        {
            MessagesModel model = new MessagesModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_mId = row["c_vc_mId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_ufgId"].ToString();
            model.c_b_isCopy = Convert.ToBoolean(row["c_b_isCopy"]);
            model.c_i_copyNO = Convert.ToInt32(row["c_i_copyNO"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// CommentsModel
        /// </summary>
        private static CommentsModel C_DataSetToModel(DataSet ds, Int32 number)
        {
            CommentsModel model = new CommentsModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_cId = row["c_vc_cId"].ToString();
            model.c_vc_ccId = row["c_vc_ccId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        #endregion

        #region Interaction 互动专区
        /// <summary>
        /// OtherModel
        /// </summary>
        private static OtherModel O_DataSetToModel(DataSet ds, Int32 number)
        {
            OtherModel model = new OtherModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_oId = row["c_vc_cId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_ntx_content = row["c_ntx_content"].ToString();
            model.c_i_commentNO = Convert.ToInt32(row["c_i_commentNO"]);
            model.c_i_readNO = Convert.ToInt32(row["c_i_readNO"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Other_CommentModel
        /// </summary>
        private static Other_CommentModel OC_DataSetToModel(DataSet ds, Int32 number)
        {
            Other_CommentModel model = new Other_CommentModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_ocId = row["c_vc_ocId"].ToString();
            model.c_vc_oId = row["c_vc_cId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// GameModel
        /// </summary>
        private static GameModel G_DataSetToModel(DataSet ds, Int32 number)
        {
            GameModel model = new GameModel();
            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_gId = row["c_vc_gId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_tx_URL = row["c_tx_URL"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        #endregion

        #region Querstion 客户意见
        /// <summary>
        /// QuestionModel
        /// </summary>
        private static QuestionModel Q_DataSetToModel(DataSet ds, Int32 number)
        {
            QuestionModel model = new QuestionModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_qId = row["c_vc_qId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_vc_title = row["c_vc_title"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_b_isReplay = Convert.ToBoolean(row["c_b_isReplay"]);
            model.c_i_readNO = Convert.ToInt32(row["c_i_readNO"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }

        /// <summary>
        /// Question_CommentModel
        /// </summary>
        private static Question_CommentModel QC_DataSetToModel(DataSet ds, Int32 number)
        {
            Question_CommentModel model = new Question_CommentModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_qcId = row["c_vc_qcId"].ToString();
            model.c_vc_qId = row["c_vc_qId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_i_type = Convert.ToInt32(row["c_i_type"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        #endregion

        #region Infomation 资讯管理
        /// <summary>
        /// InfomationModel
        /// </summary>
        private static InfomationModel I_DataSetToModel(DataSet ds, Int32 number)
        {
            InfomationModel model = new InfomationModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_iId = row["c_vc_iId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_itId = row["c_vc_itId"].ToString();
            model.c_ntx_content = row["c_ntx_content"].ToString();
            model.c_vc_title = row["c_vc_title"].ToString();
            model.c_tx_URL = row["c_tx_URL"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_i_status = Convert.ToInt32(row["c_i_status"]);
            model.c_i_hot = Convert.ToInt32(row["c_i_hot"]);
            model.c_nvc_from = row["c_nvc_from"].ToString();
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Infomation_TypeModel
        /// </summary>
        private static Infomation_TypeModel IT_DataSetToModel(DataSet ds, Int32 number)
        {
            Infomation_TypeModel model = new Infomation_TypeModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_itId = row["c_vc_itId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_infoType = row["c_vc_infoType"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Infomation_CommentModel
        /// </summary>
        private static Infomation_CommentModel IC_DataSetToModel(DataSet ds, Int32 number)
        {
            Infomation_CommentModel model = new Infomation_CommentModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_icId = row["c_vc_icId"].ToString();
            model.c_vc_iId = row["c_vc_iId"].ToString();
            model.c_vc_author = row["c_vc_author"].ToString();
            model.c_ntx_content = row["c_ntx_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        #endregion

        #region Barter 以物易物
        /// <summary>
        /// User_ShopsModel
        /// </summary>
        private static User_ShopsModel USP_DataSetToModel(DataSet ds, Int32 number)
        {
            User_ShopsModel model = new User_ShopsModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_uspId = row["c_vc_uspId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_i_uesrLevel = Convert.ToInt32(row["c_i_uesrLevel"]);
            model.c_b_isOpen = Convert.ToBoolean(row["c_b_isOpen"]);

            return model;
        }
        /// <summary>
        /// User_ComplaintsModel
        /// </summary>
        private static User_ComplaintsModel UC_DataSetToModel(DataSet ds, Int32 number)
        {
            User_ComplaintsModel model = new User_ComplaintsModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_vc_ucId = row["c_vc_ucId"].ToString();
            model.c_vc_cId = row["c_vc_cId"].ToString();
            model.c_vc_ccId = row["c_vc_ccId"].ToString();
            model.c_vc_title = row["c_vc_title"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_b_isTreatment = Convert.ToBoolean(row["c_b_isTreatment"]);
            model.c_i_cStatu = Convert.ToInt32(row["c_i_cStatu"]);
            model.c_i_ccStatu = Convert.ToInt32(row["c_i_ccStatu"]);
            model.c_vc_cQuestion = row["c_vc_cQuestion"].ToString();
            model.c_dt_complaintTime = Convert.ToDateTime(row["c_dt_complaintTime"]);
            model.c_dt_treatmentTime = Convert.ToDateTime(row["c_dt_treatmentTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// ShopsModel
        /// </summary>
        private static ShopsModel SP_DataSetToModel(DataSet ds, Int32 number)
        {
            ShopsModel model = new ShopsModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_vc_sptId = row["c_vc_sptId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_brand = row["c_vc_brand"].ToString();
            model.c_i_readNO = Convert.ToInt32(row["c_i_readNO"]);
            model.c_tx_pictureURL = row["c_tx_pictureURL"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_b_isHot = Convert.ToBoolean(row["c_b_isHot"]);
            model.c_b_isHeader = Convert.ToBoolean(row["c_b_isHeader"]);
            model.c_i_transactions = Convert.ToInt32(row["c_i_transactions"]);
            model.c_i_shopNO = Convert.ToInt32(row["c_i_shopNO"]);
            model.c_i_quality = Convert.ToInt32(row["c_i_quality"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_DetailsModel
        /// </summary>
        private static Shops_DetailsModel SPD_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_DetailsModel model = new Shops_DetailsModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_vc_spdId = row["c_vc_spdId"].ToString();
            model.c_vc_address = row["c_vc_address"].ToString();
            model.c_vc_model = row["c_vc_model"].ToString();
            model.c_vc_qualitySave = row["c_vc_qualitySave"].ToString();
            model.c_tx_pictureURL = row["c_tx_pictureURL"].ToString();
            model.c_vc_material = row["c_vc_material"].ToString();
            model.c_vc_color = row["c_vc_color"].ToString();
            model.c_d_prive = Convert.ToDecimal(row["c_b_isHeader"]);
            model.c_vc_forPeople = row["c_vc_forPeople"].ToString();
            model.c_vc_shopsDefect = row["c_vc_shopsDefect"].ToString();
            model.c_ntx_other = row["c_ntx_other"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_TypeModel
        /// </summary>
        private static Shops_TypeModel SPT_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_TypeModel model = new Shops_TypeModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_sptId = row["c_vc_sptId"].ToString();
            model.c_vc_typeName = row["c_vc_typeName"].ToString();
            model.c_vc_description = row["c_vc_description"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_NeedsModel
        /// </summary>
        private static Shops_NeedsModel SN_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_NeedsModel model = new Shops_NeedsModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_vc_snId = row["c_vc_snId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_firstShops = row["c_vc_firstShops"].ToString();
            model.c_vc_secondShops = row["c_vc_secondShops"].ToString();
            model.c_vc_thirdShops = row["c_vc_thirdShops"].ToString();
            model.c_vc_other = row["c_vc_other"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_EvaluationModel
        /// </summary>
        private static Shops_EvaluationModel SE_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_EvaluationModel model = new Shops_EvaluationModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_vc_seId = row["c_vc_seId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_b_isReplay = Convert.ToBoolean(row["c_b_isReplay"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_Evaluation_ReplayModel
        /// </summary>
        private static Shops_Evaluation_ReplayModel SER_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_Evaluation_ReplayModel model = new Shops_Evaluation_ReplayModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_serId = row["c_vc_serId"].ToString();
            model.c_vc_seId = row["c_vc_seId"].ToString();
            model.c_vc_userName = row["c_vc_userName"].ToString();
            model.c_vc_content = row["c_vc_content"].ToString();
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        /// <summary>
        /// Shops_TransactionRecordModel
        /// </summary>
        private static Shops_TransactionRecordModel STR_DataSetToModel(DataSet ds, Int32 number)
        {
            Shops_TransactionRecordModel model = new Shops_TransactionRecordModel();

            DataRow row = ds.Tables[0].Rows[number];

            model.c_vc_strId = row["c_vc_strId"].ToString();
            model.c_vc_buyId = row["c_vc_buyId"].ToString();
            model.c_vc_sellId = row["c_vc_sellId"].ToString();
            model.c_vc_spId = row["c_vc_spId"].ToString();
            model.c_b_isAgree = Convert.ToBoolean(row["c_b_isAgree"]);
            model.c_i_transactionStatu = Convert.ToInt32(row["c_i_transactionStatu"]);
            model.c_dt_dateTime = Convert.ToDateTime(row["c_dt_dateTime"]);
            model.c_b_isDel = Convert.ToBoolean(row["c_b_isDel"]);

            return model;
        }
        #endregion

        #region Source 资源管理
        #endregion

        #endregion
    }
}
